home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / qwesorcs.lha / qwe_sources / Flut!v4 / Convert.c next >
C/C++ Source or Header  |  1996-03-24  |  1KB  |  69 lines

  1. const char *_VERSION="\0$VER: Convert 1.0 (23.03.96)";
  2.  
  3. #include    <dos/dos.h>
  4.  
  5. FILE    *fp1,*fp2;
  6.  
  7. char    line[200],
  8.         gamespfad1[23]="pfiles:flut/flut.games",
  9.         gamespfad2[15]="ram:flut.games";
  10.  
  11. UBYTE    x,anzahl,xx,yy;
  12.  
  13. void main(void)
  14. {
  15.     if (fp1=fopen(gamespfad1,"r"))
  16.     {
  17.         if (fp2=fopen(gamespfad2,"w"))
  18.         {
  19.             while (fgets(line,sizeof(line),fp1))
  20.             {
  21.                 anzahl=line[0]-48;
  22.                 xx=atoi(line + 2);
  23.                 yy=atoi(line + 5);
  24.  
  25.                 if(anzahl>0 && yy>8)
  26.                 {
  27.                     for(x=0;x<anzahl*2+2;x++)
  28.                     {
  29.                         fgets(line,sizeof(line),fp1);
  30.                     }
  31.                     line[0]='0';
  32.                     line[1]=10;
  33.                     line[2]=0;
  34.                     anzahl=0;
  35.                 }
  36.  
  37.                 if(anzahl>0)
  38.                 {
  39.                     strcpy(line+8,line+19);
  40.                     fputs(line,fp2);
  41.  
  42.                     fgets(line,sizeof(line),fp1);
  43.                     fputs(line,fp2);
  44.                     fgets(line,sizeof(line),fp1);
  45.                     fputs(line,fp2);
  46.  
  47.                     for(x=0;x<anzahl;x++)
  48.                     {
  49.                         fgets(line,sizeof(line),fp1);
  50.                         line[9]=32;
  51.                         line[10]=10;
  52.                         line[11]=0;
  53.                         fputs(line,fp2);
  54.                         fgets(line,sizeof(line),fp1);
  55.                         fputs(line,fp2);
  56.                     }
  57.                 }
  58.                 else
  59.                 {
  60.                     fputs(line,fp2);
  61.                 }
  62.             }
  63.             fclose(fp2);
  64.         }
  65.         fclose(fp1);
  66.     }
  67. }
  68.  
  69.